package com.xiaoma.listener;

import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringApplicationRunListener;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.ConfigurableEnvironment;

/**
 * @description  
 * @author wangtianxiang
 * @date: 2021/11/24 10:07
 */
@Slf4j
public class DemoListener implements SpringApplicationRunListener {

    private final SpringApplication application;
    private final String[] args;

    public DemoListener(SpringApplication sa, String[] args) {
        this.application = sa;
        this.args = args;
    }

    @Override
    public void starting() {
        log.info("DemoListener starting =========================");
    }

    @Override
    public void environmentPrepared(ConfigurableEnvironment environment) {
        log.info("DemoListener environmentPrepared =========================");
    }

    @Override
    public void contextPrepared(ConfigurableApplicationContext context) {
        log.info("DemoListener contextPrepared =========================");
    }

    @Override
    public void contextLoaded(ConfigurableApplicationContext context) {

        log.info("DemoListener contextLoaded =========================");
    }

    @Override
    public void started(ConfigurableApplicationContext context) {
        log.info("DemoListener started =========================");
    }

    @Override
    public void running(ConfigurableApplicationContext context) {
        log.info("DemoListener running =========================");
    }

    @Override
    public void failed(ConfigurableApplicationContext context, Throwable exception) {
        log.info("DemoListener failed =========================");
    }
}
